package com.ttl.bc.ap.action;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.DynaActionForm;
import org.apache.struts.actions.DispatchAction;

import com.ttl.bc.ap.db.BCAPDAO;


public class BCAPAction extends DispatchAction {
		
	@SuppressWarnings("unchecked")
	public ActionForward find(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) 
			throws Exception {
		
		
		System.out.println("###############  object BcAPDao  ###############");
		DynaActionForm dynaForm = (DynaActionForm)form;
		String s = ""+dynaForm.getString("searchData");
		System.out.println("###############  Search : "+s+"  ###############");
		System.out.println("###############  before dao ###############");
		BCAPDAO dao = new BCAPDAO();		
		System.out.println("###############  after dao ###############");
		List result = dao.find(s);
		System.out.println("###############  result size=  "+result.size());
//		
		request.getSession().setAttribute("bcapData", result);
	
		return mapping.findForward("searchSuccess");
	}
}
